![]() |
PBExchangeFilesSync |
||||
Header: | Files.h | Carbon status: | Supported | |
Exchanges the data stored in two files on the same volume.
OSErr PBExchangeFilesSync ( HParmBlkPtr paramBlock );
A pointer to a basic HFS parameter block.
A result code.
The relevant fields of the parameter block are:
On input, a pointer to a completion function.
On output, the result code of the function.
On input, a pointer to a pathname.
On input, a volume specification.
On input, a pointer to the name of the destination file.
On input, the destination file’s parent directory ID.
On input, the source file’s parent directory ID.
The PBExchangeFilesSync function swaps the data in two files by changing some of the information in the volume catalog and, if the files are open, in the file control blocks. The PBExchangeFilesSync function uses the file ID parameter block.
You should use PBExchangeFilesSync to preserve the file ID when updating an existing file, in case the file is being tracked through its file ID.
Typically, you use PBExchangeFilesSync after creating a new file during a safe save. You identify the names and parent directory IDs of the two files to be exchanged in the fields ioNamePtr, ioDestNamePtr, ioSrcDirID, and ioDestDirID. The PBExchangeFilesSync function changes the fields in the catalog entries that record the location of the data and the modification dates. It swaps both the data forks and the resource forks.
The PBExchangeFilesSync function works on either open or closed files. If either file is open, PBExchangeFilesSync updates any file control blocks associated with the file. Exchanging the contents of two files requires essentially the same access privileges as opening both files for writing.
The PBExchangeFilesSync function does not require that file ID references exist for the files being exchanged.
Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)